<!--
 * @Author: your name
 * @Date: 2020-03-10 10:20:00
 * @LastEditTime: 2020-03-13 16:25:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \merchant_terminal\src\page\shop\shop_edit.vue
 -->
<!-- Add "scoped" attribute to limit CSS to this component only -->


<template>
  <div class="h100 scroll">
    <van-cell-group>
      <van-cell class="pt20 pb20" title="商铺Logo" value-class="f j-e">
        <div class="r-50 bg" style="width:0.8rem;height:0.8rem;">
          <img class="w100 h100" :src="form.logo">
        </div>
      </van-cell>
      <van-cell-group class="pt10 pb10">
        <van-field label="商铺名称" v-model="form.name" input-align="right" placeholder="请输入"/>
      </van-cell-group>
      <van-cell-group class="pt10 pb10">
        <van-field label="详细地址" v-model="form.address" input-align="right" placeholder="请输入"/>
      </van-cell-group>
      <van-cell-group class="pt10 pb10">
        <van-field
          label="营业时间"
          v-model="form.doBusinessTime"
          input-align="right"
          placeholder="请输入"
        />
      </van-cell-group>
      <van-cell-group class="pt10 pb10">
        <van-field label="联系方式" v-model="form.phone" input-align="right" placeholder="请输入"/>
      </van-cell-group>
      <van-cell-group class="pt10 pb10">
        <van-cell title="商铺简介">
          <van-field
            class="pl0 pr0"
            slot="label"
            v-model="form.descr"
            rows="2"
            autosize
            type="textarea"
            placeholder="请输入"
          />
        </van-cell>
      </van-cell-group>
      <van-cell-group class="p10" :border="false">
        <van-button type="info" block @click="editShopInfo">保存</van-button>
      </van-cell-group>
    </van-cell-group>
  </div>
</template>

<script>
import { shopInfo, shopUpdate } from "@/http/api";
export default {
  data() {
    return {
      checked: true,
      form: {}
    };
  },

  created() {
    shopInfo().then(res => {
      if (res.code === 200) {
        this.form = res.result;
      }
    });
  },

  methods: {
    editShopInfo() {
      shopUpdate(this.form).then(res => {
        if (res.code === 200) {
          //this.$link("./shop_view")
          this.$router.go(-1)
        }
      });
    }
  }
};
</script>
